<template>
  <div>
    <el-dialog title="文档预览" width="80%" :visible.sync="dialogVisible" top="15vh" class="showDialogClass"
      :before-close="handleClose">
      <div style="height:700px;overflow-y:scroll">
        <iframe scrolling="yes" :src="docUrl" style="width:100%;height:680px" />
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { updateLookCount } from "@/api/knowledge/fileBase";
import store from "@/store";
export default {
  name: `docPreviewPage`,
  data() {
    return {
      dialogVisible: false,
      loading: false,
      docUrl: ``,
    }
  },
  methods: {
    init(item) {
      this.dialogVisible = true;
      this.docUrl = item.fileUrl;
      const params = {
        userId: store.getters.user_id.toString(),
        token: store.getters.token.toString(),
        userName: store.getters.userName.toString(),
        data: {
          fileId: item.fileId,
        },
      };
      updateLookCount(params).then((res) => {
        if (res.result === true) {
          console.log("成功")
        }
      })
    },
    handleClose() {
      this.cancel()
    },
    cancel() {
      this.dialogVisible = false
      this.docUrl = ``;
    },
  },
}
</script>

<style lang="scss">
// .showDialogClass .el-dialog__body {
//   padding: 0px 20px !important;
// }
</style>
